-- This file contains instructions for replicating the empirical results in "Judicial Federalism and Replication".  

#add session info from Desktop
########################################################
ESTIMATING STATE-LEVEL PUBLIC OPINION ON SAME-SEX MARRIAGE
###############################################################
#DATA FILES#
-- The file "gay_marriage_megapoll_updated.dta" contains the  individual-level public opinion data.
-- The file "poststrats_combined_wbh.dta" contains the data used in the poststratification process.
-- The file "pres_vote_interpolated_1996_2015.dta" contains interpolated state-level presidential vote for each year.
-- The file "prop_relig.dta" contains data on the  percent of evangelical Protestants and Mormons in each state.

#R Scripts#
-- The R script "run_gay_marriage_STAN_model.R" runs the STAN model on individual-level opinion.  (Note that depending on your computing power, the model will take several days/hours to run.)  Once the model is completed, it will return the .Rdata object "gay_mar_STAN_quadratic_trend_by_state.Rdata"
-- The R script "post_process_gay_marriage_quadratic_STAN_model.R" post-processes the STAN results and completes the post-stratification to create the final state-level estimates.  For each of the state level, circuit level, and national level, there are two .csv files:
	-- "___preds_all_sims_from_STAN" contains the full dataset of simulations foe every state-year combinations (and is thus quite large)
	-- "___preds_means_quantiles_from_STAN" contains just the means and confidence intervals for each state-year combination

###########
#ANALYZING PUBLIC OPINION, STATE POLICY AND JUDICIAL DECISION
#########
#DATA FILES#
-- The file"gay_marriage_state_bans_implementation_for_analysis.csv" contains information on whether and by what means each state either banned or allowed gay marriage over time.
-- The file "gay_marriage_judicial_decisions.csv" contains data on judicial decisions ruling on the constitutionality of same-sex marriage bans. 
-- The file "state_year_ban_in_place.csv" is organized by state-year, and codes whether each state had a ban in place over time.
The file "state_referendum_results.csv" contains information on state referendum results
-- The file "state_year_population_1970_2015.csv" contains the populations of each state from 1970 to 2015.

#R Scripts#
-- The file "main_script_for_analyses.R" performs the analyses in the main paper and makes Figures 5-8.
-- The file "examine_mrp_estimates.R"  produces Figures A1 and A2 in the Appendix.
	
	
	


